﻿using NUnit.Framework;

namespace CC_NSISrunner.Tests
{
    public partial class NsisXmlFormatterTest
    {
        [Test]
        public void TestParseInputNsisVersion()
        {
            NsisXmlFormatter nsisXmlFormatter = new NsisXmlFormatter();
            Test_ParseInput(nsisXmlFormatter, "MakeNSIS v2.46 - Copyright 1995-2009 Contributors");
            Assert.AreEqual("2.46",nsisXmlFormatter.Version);
            //Assert.AreEqual(NsisOutputStateMachine.EState.VersionFound, nsisXmlFormatter.);
        }
        
        [Test]
        public void TestParseInputNsisPlugins()
        {
            NsisXmlFormatter nsisXmlFormatter = new NsisXmlFormatter();
            Test_ParseInput(nsisXmlFormatter, "Processing plugin dlls: \"C:\\Program Files (x86)\\NSIS\\Plugins\\*.dll\"");
            Assert.AreEqual("C:\\Program Files (x86)\\NSIS\\Plugins\\*.dll", nsisXmlFormatter.PluginsPath);
        }

        [Test]
        public void TestParseInputWorkDirectory()
        {
            NsisXmlFormatter nsisXmlFormatter = new NsisXmlFormatter();
            Test_ParseInput(nsisXmlFormatter, "Changing directory to: \"C:\\Projekte\\Idis\\Installer\\Caloric\"");
            Assert.AreEqual("C:\\Projekte\\Idis\\Installer\\Caloric", nsisXmlFormatter.WorkDirectory);
        }

        [Test]
        public void TestParseInputScriptBegin()
        {
            NsisXmlFormatter nsisXmlFormatter = new NsisXmlFormatter();
            Test_ParseInput(nsisXmlFormatter, "Processing script file: \"QSuite caloric.nsi\"");
            Assert.AreEqual("QSuite caloric.nsi", nsisXmlFormatter.WorkScript);
        }

        [Test]
        public void TestParseProcessedBegin()
        {
            NsisXmlFormatter nsisXmlFormatter = new NsisXmlFormatter();
            Test_ParseInput(nsisXmlFormatter, "Processed 1 file, writing output:");
            Assert.AreEqual("1", nsisXmlFormatter.ProcessedFiles);
        }

        [Test]
        public void TestParseOutputBegin()
        {
            NsisXmlFormatter nsisXmlFormatter = new NsisXmlFormatter();
            Test_ParseInput(nsisXmlFormatter, "Output: \"C:\\Projekte\\Idis\\build\\Setup Q suite 5 caloric-0.0.0.2 - QUNDIS.exe\"");
            Assert.AreEqual("C:\\Projekte\\Idis\\build\\Setup Q suite 5 caloric-0.0.0.2 - QUNDIS.exe", nsisXmlFormatter.OutputFile);
        }
    }
}
